/*
	Azid Engine is 3D Game Engine developed along side with Galactic Siege (see Google Code) 
	Copyright (C) 2010  Jorgen Ader

	This file is part of AzidEngine.

	AzidEngine is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	AzidEngine is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with AzidEngine.  If not, see <http://www.gnu.org/licenses/>. 
*/

#ifndef __EngineObjectManager_HPP__
#define __EngineObjectManager_HPP__

#include "Includes.hpp"

namespace AzidEngine
{
	/**
	 * \addtogroup ENGINE
	 * @{
	 * \addtogroup MANAGERS
	 * @{
	 */
	/* Only for GalacticSiege
	enum RenderDistance
	{
		RD_Star = 5000,
		RD_SolarSystem = 2000,
		RD_Planet = 1000,
		RD_Unit = 400
	};*/
	
	enum Type_Arch
	{
	    ARCH_ALL = 0
	};
	
	enum Type_Child
	{
	    CHILD_ALL = 0
	};
	
	/* Only for GalacticSiege
	struct TechAttributes
	{
		unsigned short		Mech;
		unsigned short		Energy;
		unsigned short		Biology;
		unsigned short		Crystal;
		unsigned short		Intelligence;
	};*/

	struct EntityData
	{
		Ogre::String		MeshName;
		Ogre::String		EntityName;
		Type_Arch			ArchType;
		Type_Child			ChildType;
		Ogre::String		NodeName;
		Ogre::Entity*		EntityPtr;
		Ogre::Real			MaxMoveSpeed;
		Ogre::Vector3		MoveVector;
		/* Only for GalacticSiege
		// Base
		unsigned int		Hitpoints;
		unsigned short		Attack;
		unsigned short		Defence;
		signed short		Agression;
		unsigned short		PlayerId;
		*/
	};

	typedef std::vector<EntityData*> EntityDataContainer;
	typedef std::vector<EntityData*>::iterator EntityDataContainerId;

	/**
	 * \class ObjectManager
	 * @{
	 **/
	class ObjectManager
	{
	public:

		/**
		 * ObjectManager constructor
		 **/
		ObjectManager();

		/**
		 * ObjectManager destructor
		 **/
		~ObjectManager();

		/**
		 * Register new object
		 * @param data
		 */
		void addEntity(EntityData* data);

		/**
		 * Removes registers previosly registered object
		 * @param data
		 */
		void removeEntity(EntityData* data);
		
		/**
		 * Return's list EntityData's with specific arch and child type
		 * @param arch	archType
		 * @param child	childType
		 */
		EntityDataContainer getEntityList(Type_Arch arch = ARCH_ALL, Type_Child child = CHILD_ALL);

		/**
		 * Returns Entity by it's name
		 * @param name
		 */
		EntityData* getEntityByName(Ogre::String name);

		/**
		 * Returns Entity by it's pointer
		 * @param ent
		 */
		EntityData* getEntityByPtr(Ogre::Entity* ent);

	private:
		
		Ogre::SceneManager*			sceneMgr;
		EntityDataContainer			entityData;
	};
	/**
	 * @}
	 * @}
	 * @}
	 */
}
#endif
